import request from "@/utils/axios.ts";
import { setCurrentUserState } from "../state/user.ts";

export const getCurrentUser = async () => {
    const res = await request.get('/user/current');
    //@ts-ignore
    if (res.code === 0) {
        setCurrentUserState(res.data);
        return res.data;
    }
    return null;
}

